package com.naiterui.ehp.bs.recommend.bean;

// default package

import javax.persistence.*;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * DocMedicationRecom entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "dr_medication_require")
public class MedicationRequire implements java.io.Serializable {

	/** 求药回复状态-全部(接口查询用) */
	public static final int REQUIRE_STATUS_ALL = 0;
	/** 求药回复状态-待处理 */
	public static final int REQUIRE_STATUS_NO_REPLY = 1;
	/** 求药回复状态 -已回复 */
	public static final int REQUIRE_STATUS_ALREADY_REPLY = 2;
	/** 求药回复状态-待支付 */
	public static final int REQUIRE_STATUS_WAIT_REPAY = 3;
	/** 求药回复状态-已通过 */
	public static final int REQUIRE_STATUS_CONFIRM_REPAY = 4;

	/** 求药申请状态-新申请 */
	public static final int APPLY_STATUS_DEFAULT = 0;
	/** 求药申请状态-已续方 */
	public static final int APPLY_STATUS_REPEAT = 1;
	/** 求药申请状态-已暂停用药 */
	public static final int APPLY_STATUS_SUSPEND = 2;
	public static final String APPLY_STATUS_SUSPEND_NAME = "暂停用药";

	/**
	 * 字段或域定义：<code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 8218298712746794035L;
	private Long id;
	private Long doctorId;
	private Long patientId;
	private Integer status;
	private Date expireAt;// 求药过期时间
	private Date spaceAt;// 求药间隔时间
	private String extId;
	private Date createdAt;
	private Date changedAt;

	private Long formerRecommendId;// 原推荐单id add version 2.14

	/**
	 * 申请状态：0:新申请（默认），1：已续方，2：暂停用药
	 */
	private Integer applyStatus;

	/**
	 * 暂停用药备注
	 */
	private String remark;

	/**
	 * 创建MedicationRecom实例
	 * 
	 */
	public MedicationRequire() {
		super();
	}

	/**
	 * 构造函数
	 * 
	 * @param doctorId
	 * @param patientId
	 */
	public MedicationRequire(Long doctorId, Long patientId, String extId, Long expiration, Long spaceTime) {
		super();
		this.doctorId = doctorId;
		this.patientId = patientId;
		status = REQUIRE_STATUS_NO_REPLY;
		this.extId = extId;
		Date date = new Date();
		createdAt = date;
		changedAt = date;
		expireAt = new Date(date.getTime() + expiration);
		spaceAt = new Date(date.getTime() + spaceTime);
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "doctor_id")
	public Long getDoctorId() {
		return doctorId;
	}

	public void setDoctorId(Long doctorId) {
		this.doctorId = doctorId;
	}

	@Column(name = "patient_id")
	public Long getPatientId() {
		return patientId;
	}

	public void setPatientId(Long patientId) {
		this.patientId = patientId;
	}

	@Column(name = "ext_id")
	public String getExtId() {
		return extId;
	}

	public void setExtId(String extId) {
		this.extId = extId;
	}

	@Column(name = "created_at", length = 19)
	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	@Column(name = "changed_at", length = 19)
	public Date getChangedAt() {
		return changedAt;
	}

	public void setChangedAt(Date changedAt) {
		this.changedAt = changedAt;
	}

	/**
	 * @return Long 取得域 status 的方法。
	 */
	@Column(name = "status")
	public Integer getStatus() {
		return status;
	}

	/**
	 * @param status
	 *            对域 status 的设置方法.
	 */
	public void setStatus(Integer status) {
		this.status = status;
	}

	/**
	 * @return Date 取得域 expireAt 的方法。
	 */
	@Column(name = "expire_at")
	public Date getExpireAt() {
		return expireAt;
	}

	/**
	 * @param expireAt
	 *            对域 expireAt 的设置方法.
	 */
	public void setExpireAt(Date expireAt) {
		this.expireAt = expireAt;
	}

	@Column(name = "former_recommend_id")
	public Long getFormerRecommendId() {
		return formerRecommendId;
	}

	public void setFormerRecommendId(Long formerRecommendId) {
		this.formerRecommendId = formerRecommendId;
	}

	@Column(name = "apply_status")
	public Integer getApplyStatus() {
		return applyStatus;
	}

	public void setApplyStatus(Integer applyStatus) {
		this.applyStatus = applyStatus;
	}

	@Column(name = "space_at")
	public Date getSpaceAt() {
		return spaceAt;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void setSpaceAt(Date spaceAt) {
		this.spaceAt = spaceAt;
	}


}
